import Vue from 'vue'
import VueRouter from 'vue-router'



Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'login'
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login'),
    meta: {
      title: '登录 - 心理问题筛查管理平台'
    }
  },
  {
    path: '/home/:username',
    name: 'Home',
    component: () => import('../views/Home'),
    children:[
      {
        path: '/namelist',
        name: 'NameList',
        component: () => import('../views/others/NameList.vue')
      },
      {
        path: '/others-evaluation',
        name: 'Others',
        component: () => import('../views/others/Others.vue')
      },
      {
        path: '/others-question',
        name: 'Question',
        component: () => import('../views/others/Question.vue')
      },
      {
        path: '/self-centre',
        name: 'SelfCentre',
        component: () => import('../views/SelfCentre.vue')
      }
    ]
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register'),
    meta: {
      title: '注册 - 心理问题筛查管理平台'
    }
  },
  {
    path: '*',
    name: 'NotFound',
    component: () => import('../views/NotFound'),
    meta: {
      title: '页面不见了 - 心理问题筛查管理平台'
    }
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
